package com.chai.dao;

import com.chai.domain.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDao {

    @Insert("insert into tb_book (type,name,description) value (#{type},#{name},#{description})")
    public int save(Book book);

    @Delete("delete from tb_book where id =#{id}")
    public int deleteById(int id);

    @Update("update tb_book set type=#{type},name=#{name},description=#{description} where id=#{id}")
    public int update(Book book);

    @Select("select * from tb_book where id =#{id}")
    public Book selectById(int id);

    @Select("select * from tb_book")
    public List<Book> selectAll();

}
